﻿@{
    ViewBag.Title = "GetLeaveRequestTable";
}
<script src="../../Scripts/Data_Table/jquery.dataTables.min.js" type="text/javascript"></script>
<script type="text/javascript">

    $(document).ready(function () {

       // setupLeftMenu();

        var oTable2 = $('#leaveRequestsTable').dataTable({

            "bServerSide": true,
            "sAjaxSource": "/LeaveRequests/AjaxGetLeaveRequestsEmployee",
            "bProcessing": true,
            "sPaginationType": "full_numbers",
            "aoColumns":
[
{ "sName": "LeaveId", "sTitle": "Leave ID", "bVisible": false, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[0]; } },
{ "sName": "CreatedDate", "sTitle": "Date", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[1]; } },
            //{ "sName": "EmployeeName", "sTitle": "Employee Name", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[2]; } },
{"sName": "LeaveReason", "sTitle": "Reason", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[2]; } },
{ "sName": "Type", "sTitle": "Type", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[3]; } },
{ "sName": "From", "sTitle": "From", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[4]; } },
{ "sName": "To", "sTitle": "To", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[5]; } },
{ "sName": "Status", "sTitle": "Status", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[6]; } },
{ "sName": "Remark", "sTitle": "Remark", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[7]; } },
{ "sName": "Withdraw", "sTitle": "Withdraw", "bVisible": true, "bSortable": true, "fnRender": function (oObj) { return oObj.aData[8]; } },


]
        });
        oTable2 = $('#leaveRequestsTable').dataTable();


       // setSidebarHeight();


    });
    function WithdrawLeave(leaveId,flag) {

        $.ajax({
            type: 'post',
            url: '/LeaveRequests/LeaveWithdraw?leaveRequestId=' + leaveId + '&flag=' + flag,
            success: function (data) {
                oTable2 = $('#leaveRequestsTable').dataTable();
                oTable2.fnDraw();
            }
        });
    }


</script>
 <div class="grid_5">

            <div class="box round">
                <h2>Leave Requests</h2>
                <div class="block">
                    
                    <table class="data display datatable" id="leaveRequestsTable">
					<thead>
                <tr>
                 
                     <th>
                    </th>
                    <th>
                    </th>
                    <th>
                    </th> 
                    <th>
                    </th>                    
                    <th>
                        
                    </th>
                     <th>
                        
                    </th>
                    <th>
                    </th>
                     <th>
                    </th>
                     <th>
                    </th>
                    
                </tr>
            </thead>
					
				</table>
                   

                    
                </div>
            </div>
            
        </div>
        
